package com.koron.device.monitor.ycsw.bean;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.text.ParseException;
import java.text.SimpleDateFormat;

/**
 * @ClassName: ManualdataBean
 * @Description:
 * @Date: 2023/1/3
 * @Author: 李一辰
 * @Version: 1.0
 **/
@Data
@Slf4j
public class ManualdataBean implements IdentityBean, Comparable<ManualdataBean>{
    private Integer id;
    private String type;
    private String user;
    private String name;
    private String date;
    private String time;
    private String created;
    private String changed;
    private String factory;
    private String station;
    private String code;
    private String value;
    private Integer status;
    private String muser;        //修改人
    private String mname;        //修改人姓名
    private String sensorname;
    private String dateTime;
    private String stype;


    @Override
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getUser() {
        return user;
    }
    public void setUser(String user) {
        this.user = user;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getDate() {
        return date;
    }
    public void setDate(String date) {
        this.date = date;
    }
    public String getTime() {
        return time;
    }
    public void setTime(String time) {
        this.time = time;
    }
    public String getCreated() {
        return created;
    }
    public void setCreated(String created) {
        this.created = created;
    }
    public String getChanged() {
        return changed;
    }
    public void setChanged(String changed) {
        this.changed = changed;
    }
    public String getFactory() {
        return factory;
    }
    public void setFactory(String factory) {
        this.factory = factory;
    }
    public String getStation() {
        return station;
    }
    public void setStation(String station) {
        this.station = station;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }

    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getMuser() {
        return muser;
    }
    public void setMuser(String muser) {
        this.muser = muser;
    }
    public String getMname() {
        return mname;
    }
    public void setMname(String mname) {
        this.mname = mname;
    }

    public String getSensorname() {
        return sensorname;
    }
    public void setSensorname(String sensorname) {
        this.sensorname = sensorname;
    }
    /* (non-Javadoc)
     * @see java.lang.Comparable#compareTo(java.lang.Object)
     */
    @Override
    public int compareTo(ManualdataBean o) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        long time2=0;;
        long time3=0;
        try {
            time2 = simpleDateFormat.parse(this.dateTime).getTime();
            time3 = simpleDateFormat.parse(o.dateTime).getTime();
        } catch (ParseException e) {
            log.error(e.getMessage(), e);
        }

        if (time2 > time3) {
            return (int)(time2 - time3);
        }
        if (time2 < time3) {
            return (int)(time2 - time3);
        }


        return 0;

    }

}
